﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace TaskService
{
	// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
	public class DataAccessService : IDataAccessService
	{
		private DBModelContainer _dataRepository = new DBModelContainer();

		public string GetData(int value)
		{
			return string.Format("You entered: {0}", value);
		}

		public CompositeType GetDataUsingDataContract(CompositeType composite)
		{
			if (composite == null)
			{
				throw new ArgumentNullException("composite");
			}
			if (composite.BoolValue)
			{
				composite.StringValue += "Suffix";
			}
			return composite;
		}
		

		public void AddTask(CommonClasses.Task newTask)
		{
			_dataRepository.TasksSet.AddObject(new Tasks
			                                   	{
													Description = newTask.Description,
			                                   		day = newTask.Day,
													startTime = newTask.StartTime,
			                                   		endTime = newTask.EndTime
			                                   	});
		}

		public IEnumerable<Tasks> GetTasks(DateTime day)
		{
			throw new NotImplementedException();
		}

		public void EditTask(int taskId, CommonClasses.Task newData)
		{
			throw new NotImplementedException();
		}

		public void DeleteTask(int taskId)
		{
			throw new NotImplementedException();
		}

		public void DeleteTask(CommonClasses.Task taskToDelete)
		{
			throw new NotImplementedException();
		}
	}
}
